//
//  MarketFooterView.m
//  digitalCurrency
//
//  Created by 默认账户 on 2019/4/3.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "MarketFooterView.h"

@implementation MarketFooterView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self makeviews];
    }
    return self;
}

- (void)makeviews {
    
    UILabel *tipsTitle = [[UILabel alloc] init];
    tipsTitle.font = [UIFont systemFontOfSize:14];
    tipsTitle.textColor = [UIColor whiteColor];
    tipsTitle.text = LocalizationKey(@"Panic buying rules");
    
    [self addSubview:tipsTitle];
    [tipsTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30);
        make.top.mas_equalTo(20);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *tipslabel = [[UILabel alloc] init];
    [self addSubview:tipslabel];
    tipslabel.font = [UIFont systemFontOfSize:14];
    tipslabel.numberOfLines = 0;
    tipslabel.textColor = [UIColor colorWithRed:148/255.0 green:255/255.0 blue:255/255.0 alpha:1.0];
    [tipslabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30);
        make.top.mas_equalTo(45);
        make.right.mas_equalTo(-30);
    }];
    NSString *str1 = LocalizationKey(@"qianggou1");
    NSString *str2 = LocalizationKey(@"qianggou2");
    NSString *str3 = LocalizationKey(@"qianggou3");
    NSString *str  = [NSString stringWithFormat:@"%@\n%@\n%@",str1,str2,str3];
    
    NSMutableAttributedString *string = [[NSMutableAttributedString alloc]
       initWithString:str attributes:@{
                                        NSFontAttributeName: [UIFont fontWithName:@"PingFangSC-Regular" size: 12],
                                        NSKernAttributeName:@(1),
                                        NSForegroundColorAttributeName: [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0]
                                        }];
//    [string addAttribute:NSFontAttributeName value:kFont(15) range:NSMakeRange(0, str1.length)];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    paragraphStyle.lineSpacing = 5; // 调整行间距
    //paragraphStyle.firstLineHeadIndent = 10;//首行缩进
    NSRange range = NSMakeRange(0, [string length]);
    [string addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];
    
    
    tipslabel.attributedText = string;
    [self addSubview:tipslabel];
}

@end
